<template>
  <div class="home">
    <NavView></NavView>

    <el-container>
      <el-aside width="auto">
        <div style="text-align: center; font-size: 30px; color: black">
          <i v-if="isFlag" @click="isFlag = false" class="el-icon-s-unfold"></i>
          <i v-else @click="isFlag = true" class="el-icon-s-fold"></i>
        </div>
        <el-menu
          :collapse="isFlag"
          :default-active="$route.path"
          router
          class="el-menu-vertical-demo"
        >
          <el-submenu index="1">
            <template slot="title"
              ><i class="el-icon-message"></i> <span>留言管理</span>
            </template>
            <!-- 每一项 -->
            <el-menu-item index="addview">
              <i class="el-icon-message"></i>添加留言
            </el-menu-item>
            <el-menu-item index="lookview">
              <i class="el-icon-message"></i>留言看板
            </el-menu-item>
          </el-submenu>
          <el-menu-item index="userlist">
            <i class="el-icon-message"></i><span>用户管理</span>
          </el-menu-item>
        </el-menu>
      </el-aside>

      <el-main>
        <router-view />
      </el-main>
    </el-container>
  </div>
</template>

<script>
import NavView from "../components/NavView.vue";

export default {
  components: {
    NavView,
  },
  data() {
    return {
      isFlag: false, //false展开，true收起
    };
  },
  created() {
    console.log(this.$route.params);
  },
};
</script>


<style scoped>
.el-header {
  background-color: #b3c0d1;
  color: #333;
  line-height: 60px;
}
.el-submenu,
.el-menu,
.el-menu-item {
  background-color: #333;
  color: #dccfcf;
}
.el-aside {
  background-color: #333;
}
>>> .el-aside span {
  color: #dccfcf;
}
.home {
  height: calc(100% - 60px);
}
.el-container,
.el-aside {
  height: 100%;
}
/* :not([类名])  如果没有这个类名，则开始执行这个样式 */
.el-menu-vertical-demo:not(.el-menu--collapse) {
  /* color: red; */
  width: 200px;
}
.el-icon-s-fold,
.el-icon-s-unfold {
  color: #dccfcf;
}
.el-menu-item:focus,
.el-menu-item:hover {
  outline: 0;
  background-color: #20212290;
}
>>> .el-submenu__title:hover {
  background-color: #20212290;
  outline: 0;
}
>>> .el-menu-item [class^="el-icon-"] {
  margin-right: 10px;
}
</style>
